#pragma once
#include <RC3DGameComponent.h>
#include <RCCustomVertex.h>

using namespace RCDX11;
using namespace DirectX;

class TestCube : public RC3DGameComponent, public IDrawable
{
protected:
	struct CBChangeOnResize
	{
		XMMATRIX mProjection;
	};

	struct CBChangesEveryFrame
	{
		XMMATRIX mWorld;
		XMFLOAT4 vMeshColor;
		XMMATRIX mView;
	};

	ID3D11InputLayout* pVertexLayout;

	ID3D11VertexShader* pVertexShader;
	ID3D11PixelShader*  pPixelShader;

	ID3D11Buffer* pVertexBuffer;
	ID3D11Buffer* pIndexBuffer;

	ID3D11Buffer* pCBNeverChanges;
	ID3D11Buffer* pCBChangeOnResize;
	ID3D11Buffer* pCBChangesEveryFrame;

	ID3D11ShaderResourceView* pTextureRV;

	ID3D11SamplerState* pSamplerLinear;

	IRCCamera* camera;

	PositionTexVertex vertices[24];
	WORD indices[36];
	D3D11_INPUT_ELEMENT_DESC layout[2];

	bool Visible;

public:
	TestCube(void);
	~TestCube(void);

	XMFLOAT4 Color;

	void Initialize();
	void Draw(float time);
	void setCamera(IRCCamera* cam);

	bool getVisible();
	void setVisible(bool value);
};

